package com.stlm2.dems.entity;

/**
 * Created by ZLQ on 2017/6/10.
 */
public enum ShoppingCartState {
    Valid(1) {
        public String toString() {
            return "已选";
        }
    },
    NotSet(4) {
        public String toString() {
            return "未选";
        }
    },
    Invalid(2) {
        public String toString() {
            return "无效";
        }
    },
    HaveAlreadyBought(3) {
        public String toString() {
            return "提交订单";
        }
    },
    NoSelect(5) {
        public String toString() {
            return "不可选择";
        }
    };
    private final int val;

    ShoppingCartState(int n) {
        val = n;
    }

    public int getIntValue() {
        return val;
    }

    public static ShoppingCartState getByIntValue(int n) {
        switch (n) {
            case 1:
                return  Valid;
            case 2:
                return Invalid;
            case 3:
                return HaveAlreadyBought;
            case 4:
                return NotSet;
            case 5:
                return NoSelect;
            default:
                return null;
        }
    }
}
